
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
      
        // class 定义对象类型的函数

        class Person{
            constructor(name,age){
                this.name = name
                this.age= age
            }  
            sayHi(){
                console.log(`hi,my name is ${this.name}`)
            }  
        }
        // 类函数继承使用extends方法
        class Student extends Person{
            constructor(name,age,number){
                // super 对象指向父类
                super(name,age)
                this.number= number
            }  
            hello(){A 
                super.sayHi()
                console.log(`学号是 ${this.number}`)
            }  
        }
        const s1= new Student("yy",12,"001")
        s1.hello()
        console.log(s1)

    </script>
</body>
</html>